﻿using log4net;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using WMSSyncData.Core;

namespace WMSSyncRMData.ToERP
{
    public class SyncRMJob : IJob
    {
        private readonly ILog _logger = LogManager.GetLogger(typeof(SyncRMJob));
        public void Execute(IJobExecutionContext context)
        {

            new Thread(() =>
            {
                try
                {
                    _logger.Info("SSyncRMToWMERP.InStockRMSync采购收货作业执行开始!");
                    new WMSSyncRMToERP().InStockSync();
                    _logger.Info("SSyncRMToWMERP.InStockRMSync采购收货订单作业执行结束!");
                }
                catch (Exception)
                {

                }
            }).Start();

            new Thread(() =>
            {
                try
                {
                    _logger.Info("SSyncRMToWMERP.InStockFBSYnc分包收货作业执行开始!");
                    new WMSSyncRMToERP().InStockFBSYnc();
                    _logger.Info("SSyncRMToWMERP.InStockFBSYnc分包收货作业执行结束!");
                }
                catch { }
            }).Start();

            new Thread(() =>
            {
                try
                {
                    _logger.Info("SSyncRMToWMERP.InStockPRSync生产退料作业执行开始!");
                    new WMSSyncRMToERP().InStockPRSync();
                    _logger.Info("SSyncRMToWMERP.InStockPRSync生产退料作业执行结束!");
                }
                catch (Exception)
                {

                }
            }).Start();
            //new Thread(() =>
            //{
            //    _logger.Info("SSyncRMToWMERP.InStockPRBOMSync非MES生产退料作业执行开始!");
            //    new WMSSyncRMToERP().InStockPRBOMSync();
            //    _logger.Info("SSyncRMToWMERP.InStockPRBOMSync非MES生产退料作业执行结束!");
            //}).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("SSyncRMToWMERP.InStockPOMSync生产领料作业执行开始!");
                    new WMSSyncRMToERP().OutStockPOMSync();
                    _logger.Info("SSyncRMToWMERP.InStockPOMSync生产领料作业执行结束!");
                }
                catch (Exception)
                {

                }
            }).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("SSyncRMToWMERP.OutStockPOMBOMSync采购退货作业执行开始!");
                    new WMSSyncRMToERP().OutStockPOMBOMSync();
                    _logger.Info("SSyncRMToWMERP.OutStockPOMBOMSync采购退货作业执行结束!");
                }
                catch (Exception)
                {

                }
            }).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("SSyncRMToWMERP.IQCSync检验作业执行开始!");
                    new WMSSyncRMToERP().IQCSync();
                    _logger.Info("SSyncRMToWMERP.IQCSync检验作业执行结束!");
                }
                catch (Exception)
                {

                }
            }).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("SSyncRMToWMERP.RequestSync非生产领料作业执行开始!");
                    new WMSSyncRMToERP().RequestSync();
                    _logger.Info("SSyncRMToWMERP.RequestSync非生产领料作业执行结束!");
                }
                catch (Exception)
                {

                }
            }).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("SSyncRMToWMERP.PBackSync退捡作业执行开始!");
                    new WMSSyncRMToERP().PBackSync();
                    _logger.Info("SSyncRMToWMERP.PBackSync退捡作业执行结束!");
                }
                catch (Exception)
                {

                }
            }).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("SSyncRMToWMERP.TransferSync移库同步作业执行开始!");
                    new WMSSyncRMToERP().TransferSync();
                    _logger.Info("SSyncRMToWMERP.TransferSync移库同步作业执行结束!");
                }
                catch (Exception)
                {

                }
            }).Start();
            new Thread(() =>
            {
                try
                {
                    _logger.Info("SSyncRMToWMERP.RMOutStatuOverSync更新完成状态同步作业执行开始!");
                    new WMSSyncRMToERP().RMOutStatuOverSync();
                    _logger.Info("SSyncRMToWMERP.RMOutStatuOverSync更新完成状态同步作业执行结束!");
                }
                catch (Exception)
                {
                }
            }).Start();

        }
    }
}
